package com.big.merchan.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.big.merchan.mapper.MerchandiseReplyMapper;
import com.big.merchan.service.MerchandiseReplyService;
import com.big.model.model.merchandise.comment.MerchandiseReply;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class MerchandiseReplyServiceImpl extends ServiceImpl<MerchandiseReplyMapper, MerchandiseReply> implements MerchandiseReplyService {


    /**
     * 回复
     * @return
     */
    @Override
    public List<MerchandiseReply> replyInfos(Long mId,Long cId) {
        QueryWrapper<MerchandiseReply>queryWrapper=new QueryWrapper<>();
        if(!StringUtils.isEmpty(String.valueOf(mId))){
            queryWrapper.eq("m_id",mId);
        }

        if(!StringUtils.isEmpty(String.valueOf(cId))){
            queryWrapper.eq("c_id",cId);
        }
        List<MerchandiseReply> merchandiseReplies = baseMapper.selectList(queryWrapper);
        return merchandiseReplies;
    }



//    /**
//     * 子回复 Long cId,Long rId
//     * @return
//     */
//    @Override
//    public MerchandiseReply replyInfo(MerchandiseReply reply) {
//        QueryWrapper<MerchandiseReply>queryWrapper=new QueryWrapper<>();
//        if(!StringUtils.isEmpty(String.valueOf(reply.getCId()))){
//            queryWrapper.eq("c_id",reply.getCId());
//
//        }
//        if(!StringUtils.isEmpty(String.valueOf(reply.getCId()))){
//            queryWrapper.eq("c_id",reply.getCId());
//        }
//
//        MerchandiseReply merchandiseReplie = baseMapper.selectOne(queryWrapper);
//        return null;
//    }




}
